<template>
  <div id="centerRight1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span style="color:#5cd9e8">
          <icon name="chart-line"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">大盘实时交易</span>
        </div>
      </div>
      <div class="d-flex jc-center body-box">
        <dv-scroll-board :config="config" style="" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      config: {
        header: ["商品名称", "商品类别", "成交金额"],
        data: [
          ["黑管唇釉416号", "美妆", "<span  class='colorGrass'>1045</span>"],
          ["南极人NanJiren 全棉四件套", "家居", "<span  class='colorRed'>245</span>"],
          ["天堂伞 晴雨伞", "家居", "<span  class='colorGrass'>25</span>"],
          ["米其林轮胎Michelin", "汽车用品", "<span  class='colorGrass'>700</span>"],
          ["短袖T恤男L438144LE", "服装用品", "<span  class='colorGrass'>105</span>"],
          ["华鹤木门 卫生间折叠门", "建筑材料", "<span  class='colorGrass'>568</span>"],
          ["蒙娜丽莎瓷砖客厅", "建筑材料", "<span  class='colorGrass'>2564</span>"],
          ["艾杰普 指甲刀套装", "美妆礼品", "<span  class='colorRed'>19.25</span>"],
          ["指甲刀单个", "美妆礼品", "<span  class='colorRed'>16.00</span>"],
          ["苹果11钢化膜iphone XR", "手机配件", "<span  class='colorGrass'>22.00</span>"]
        ],
        rowNum: 7, //表格行数
        headerHeight: 35,
        headerBGC: "#0f1325", //表头
        oddRowBGC: "#0f1325", //奇数行
        evenRowBGC: "#171c33", //偶数行
        index: true,
        columnWidth: [50],
        align: ["center"]
      }
    };
  },
  components: {},
  mounted() {
    this.timer = setInterval(this.getdata, 1000);
  },
  methods: {
    getdata() {
      console.log("哈哈");
      var _this = this
      this.$http.post("http://127.0.0.1:8180/realTimeTrade1").then((reponse)=>{
        console.log(reponse.body.tradeListString)

        _this.config = {
          header: ["商品名称", "商品类别", "成交金额"],
                  data:  reponse.body.tradeList
        }
      })
    }
  }
};
</script>

<style lang="scss">
#centerRight1 {
  padding: 0.2rem;
  height: 5.125rem;
  min-width: 3.75rem;
  border-radius: 0.0625rem;
  .bg-color-black {
    height: 4.8125rem;
    border-radius: 0.125rem;
  }
  .text {
    color: #c3cbde;
  }
  .body-box {
    border-radius: 0.125rem;
    overflow: hidden;
  }
}
</style>
